/*
package com.admin.common.util;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.util.CollectionUtils;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;

*/
/***
 * @author wzj
 *//*

@Slf4j
public class PageDataUtil {

    */
/**
     * 拷贝分页结果
     *
     * @param srouce 从DAL得到的分页结果
     * @return DTO层的分页模型
     *//*

    public static <T> PageInfo<T> copyPageInfo(Page<T> srouce) {
        PageInfo<T> pageInfo = new PageInfo<>();
        pageInfo.setList(srouce.getRecords());
        int curSize = srouce.getRecords() == null ? 0 : srouce.getRecords().size();
        pageInfo.setPageSize(curSize);
        pageInfo.setPageNum((int) srouce.getCurrent());
        pageInfo.setPageSize((int) srouce.getSize());
        pageInfo.setTotal((int) srouce.getTotal());
        pageInfo.setPages((int) srouce.getPages());
        return pageInfo;
    }

    public static <T> PageInfo<T> copyPageInfo(Page srouce, Class<T> clazz) {
        PageInfo<T> pageInfo = new PageInfo<>();
        pageInfo.setList(copyList(srouce.getRecords(), clazz));
        int curSize = srouce.getRecords() == null ? 0 : srouce.getRecords().size();
        pageInfo.setPageSize(curSize);
        pageInfo.setPageNum((int) srouce.getCurrent());
        pageInfo.setPageSize((int) srouce.getSize());
        pageInfo.setTotal((int) srouce.getTotal());
        pageInfo.setPages((int) srouce.getPages());
        return pageInfo;
    }


    public static <T> List<T> copyList(Collection<?> source, Class<T> clazz) {
        if (CollectionUtils.isEmpty(source)) {
            return Collections.emptyList();
        }
        try {
            List<T> records = new ArrayList<T>(source.size());
            for (Object src : source) {
                T item = clazz.newInstance();
                copy(src, item);
                records.add(item);
            }
            return records;
        } catch (Exception ex) {
            throw new RuntimeException("copy data fail", ex);
        }
    }

    public static void copy(Object src, Object dest) {
        try {

            BeanUtils.copyProperties(src, dest);
        } catch (Exception e) {
            log.error(e.getMessage(), e);
        }
    }
}*/
